<?php
if (!is_readable($filepath)) {
    die('missing file');
}
header('Cache-control: max-age=31536000');
header('Expires: ' . gmdate('D, d M Y H:i:s',time()+31536000) . ' GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s',$attachinfo['dateline']) . ' GMT');
header('Content-Encoding: none');
header('Content-type: '.$attachinfo['filetype']);
header('Content-Disposition: filename='.urlencode($attachinfo['filename']));
header('Content-Length: '.filesize($filepath));
$fp = fopen($filepath, 'rb');
fpassthru($fp);
fclose($fp);
?>
